﻿using System;
using System.ComponentModel;
using PowerPoint;
using WPSPropertyPlugin.Shapes;

namespace WPSPropertyPlugin
{
  /// <summary>
  /// Office对象的自定义属性对象
  /// </summary>
  public class ShapeProperty : IDisposable
  {
    private IOfficeShape _shapeObject = null;

    public const string SHAPE_GUID_FIELD = "SHAPE_GUID";

    public ShapeProperty(IOfficeShape shapeObject)
    {
      _shapeObject = shapeObject;
    }
    
    [Browsable(true)]
    [Category("基础")]
    public string Name
    {
      get
      {
        return _shapeObject.Name;
      }
      set
      {
        _shapeObject.Name = value;
      }
    }


    [Browsable(false)]
    public string Config
    {
      get
      {
        return _shapeObject.Config;
      }
      set
      {
        _shapeObject.Config = value;
      }
    }

    [Browsable(true)]
    [Category("其它")]
    public string GUID
    {
      get
      {
        return _shapeObject.Guid;
      }
      set
      {
        _shapeObject.Guid = value;
      }
    }

    public void SaveConfig()
    {
      _shapeObject.SaveConfig();
    }

    #region IDisposable 成员

    public void Dispose()
    {
      _shapeObject = null;
    }

    ~ShapeProperty()
    {
      Dispose();
    }

    #endregion
  }
}
